
import java.util.Arrays;
import static java.lang.Math.*;

class Person{
    private String name;
    private int age;
    String sex;//默认不写的话就是包访问权限

    public Person(){
        System.out.println("不带参数的构造方法");
    }

    public Person(String name, int age) {
        this.name = name;
        this.age = age;
        System.out.println("带两个参数的构造方法");
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }
    //私有的方法 只能从类里面调用
    private void sleep(){
        System.out.println(this.name + "正在吃饭");
    }

    public void eat(){
        this.sleep();
    }

    @Override
    public String toString() {
        return "Person{" +
                "name='" + name + '\'' +
                ", age=" + age +
                ", sex='" + sex + '\'' +
                '}';
    }
}

public class TestDemo {
    public String sex;

    public static void func2(int a){
        int x = 10;
        System.out.println(a);
    }

    public static void main(String[] args) {
        func2(10);
    }

    public static void main5(String[] args) {
        com.bit.demo1.TestDemo testDemo = new com.bit.demo1.TestDemo();
    }

    public static void main4(String[] args) {
        //导入包之后就可以这样的使用，但一般不常用
        double result2 = sqrt(pow(3,2) + pow(4,2));

        //java的lang包是不用引用的
        double result = Math.sqrt(Math.pow(3,2) + Math.pow(4,2));
        System.out.println(result);
    }

    public static void main3(String[] args) {
        java.util.Date date = new java.util.Date();
        System.out.println(date.getTime());
        int[] array = {1,2,3};
        System.out.println(Arrays.toString(array));
    }

    public static void main2(String[] args) {
        Person person1 = new Person();
        person1.setName("关羽");
        person1.eat();
        System.out.println(person1);

        System.out.println("==========");
        Person person2 = new Person();
        System.out.println("==========");
        Person person3 = new Person("zhangfei",98);
        System.out.println(person3);
    }

    public static void main1(String[] args) {
        Person person1 = new Person();
        //person1.name = "gaobo";
        //person1.sleep();
        Person person2 = new Person();
        //person2.name = "bit";
        //person2.sleep();
    }
}
